<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>订单管理</title>
    <meta name="keywords" content="订单管理">
    <meta name="description" content="订单管理">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="__ADMIN__/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="__ADMIN__/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN__/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="__ADMIN__/css/animate.min.css" rel="stylesheet">
    <link href="__ADMIN__/css/style.min862f.css?v=4.1.0" rel="stylesheet">
    <script src="__ADMIN__/js/jquery.min.js?v=2.1.4"></script>
    <link href="__ADMIN__/css/admin.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeIn">
        <div class="row">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                                <form method="post" class="form-horizontal" action="{:url('index')}" data-type="ajax">
                                    <div class="table-responsive">
                                        <table id="dataTables-example" class="table table-striped">
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>订单号</th>
                                                    <th>支付订单</th>
                                                    <th>用户名</th>
                                                    <th>订单状态</th>
                                                    <th>快递单号</th>
                                                    <th>收货人</th>
                                                    <th>地址</th>
                                                    <th>手机</th>
                                                    <th>订单总价</th>
                                                    <th>下单时间</th>
                                                    <th>操作</th>
                                                </tr>
                                            </thead>
                                        </table>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__ADMIN__/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__ADMIN__/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="__ADMIN__/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="__ADMIN__/js/content.min.js?v=1.0.0"></script>
    <script src="__ADMIN__/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__ADMIN__/js/plugins/layer/layer.min.js"></script>
    <script src="__ADMIN__/js/layer_hplus.js"></script>
    <script src="__ADMIN__/js/plugins/layer/laydate/laydate.js"></script>
    <script>
        $(document).ready(function() {
            $("#dataTables-example").on('click', 'a.checkexpress', function(){
                var id = $(this).attr('id');
                layer.open({
                    type:2,
                    title:'物流信息',
                    area:['720px', '530px'],
                    fixed:false,
                    maxmin:true,
                    shade:0.1,
                    content: "{:url('/admin/order/checkexpress/id/"+id+"')}"
                });
            });

            $("#dataTables-example").on('click', 'a.express', function(){
                var id = $(this).attr('id');
                layer.open({
                    type:2,
                    title:'录入单号',
                    area:['720px', '530px'],
                    fixed:false,
                    maxmin:true,
                    shade:0.1,
                    content: "{:url('/admin/order/express/id/"+id+"')}"
                });
            });

            $("#dataTables-example").on('click', 'a.goods', function(){
                var id = $(this).attr('oid');
                //弹出框显示该订单的商品
                layer.open({
                    type:2,
                    title:'订单商品',
                    area:['900px', '500px'],
                    fixed:false,
                    maxmin:true,
                    shade:0.1,
                    content: "{:url('/admin/order/orderGoods/id/"+id+"')}"
                });
            });

            $("#dataTables-example").on('click', 'a.change_order_status', function(){
                var id = $(this).attr('id');
                $.ajax({
                    type: 'POST',
                    dataType: 'json',
                    url:"{:url('changeOrderStatus')}",
                    data:{'id':id},
                    success: function(obj){
                        if(obj.status == 200){
                            layer.open({
                                content: obj.msg,
                                btn:['确定'],
                                shade:0.1,
                                icon:1,
                                end:function(){
                                    $('#order_status_'+id).html(obj.order_status);
                                    $('#'+id).html(obj.order_status);
                                }
                            });
                        }else{
                            layer.open({
                                content: obj.msg,
                                btn:['确定'],
                                shade:0.1,
                                icon:2
                            });
                        }
                    }
                });
            });

            $("#dataTables-example").dataTable({
                "bAutoWidth": false,
                "serverSide": true,
                "ajax": {
                    "url": "{:url('getDataTables')}",
                    "data": function(d) {
                        d.extra_search = "order_sn|order_sn_submit|consignee|address|mobile";
                    }
                },
                "ordering": false, //禁用全局排序
                "order": [0, '`id` desc'],
                "lengthMenu": [10, 20, 50, 100],
                "dom": "<'row'<'#normalToos.col-xs-4'><'col-xs-8'f>>" +
                    "<'row'<'col-xs-12't>>" +
                    "<'row'<'col-xs-6'li><'col-xs-6'p>>",
                "language": {
                    "zeroRecords": "没有检索到数据",
                    "lengthMenu": "每页 _MENU_ 条记录&nbsp;&nbsp;",
                    "search": "搜索 ",
                    "info": "共 _PAGES_ 页，_TOTAL_ 条记录，当前显示 _START_ 到 _END_ 条",
                    "paginate": {
                        "previous": "上一页",
                        "next": "下一页",
                    }
                },
                "columns": [{
                    data: "id"
                }, {
                    data: "order_sn"
                }, {
                    data: "order_sn_submit"
                }, {
                    data: "uid"
                }, {
                    data: "order_status"
                }, {
                    data: "expressnum"
                }, {
                    data: "consignee"
                }, {
                    data: "address"
                }, {
                    data: "mobile"
                }, {
                    data: "amount"
                }, {
                    data: "submit_time"
                }, {
                    data: "operate"
                }, ],
                "drawCallback": function() {
                    normal_init();
                }
            });

        });
    </script>
</body>

</html>
